<template>
	<view class="cantainer">
		<image class="top-image" src="/static/images/topbg2png.png" mode=""></image>
		<view class="userinfo">
			<image :src="userinfo.avatar" mode=""></image>
			<view class="user">
				<view>{{userinfo.nickname}}</view>
				<view>{{userinfo.mobile}}</view>
			</view>
		</view>
		<!-- tab -->
		<view class="tab" @click="goPath('/pages/user/edituserinfo/edituserinfo')">
			<view>个人资料</view>
			<image src="/static/images/left.png" mode=""></image>
		</view>
		<view class="tab" @click="goPath('/pages/wallet/wallet')">
			<view>我的钱包</view>
			<image src="/static/images/left.png" mode=""></image>
		</view>
		<view class="tab" @click="goPath('/pages/bank/bank')">
			<view>我的银行卡</view>
			<image src="/static/images/left.png" mode=""></image>
		</view>
		<view class="tab" @click="goPath('/pages/history-data/history-data')">
			<view>历史数据</view>
			<image src="/static/images/left.png" mode=""></image>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userinfo: uni.getStorageSync('userinfo')
			}
		},
		onShow() {
			if (!uni.getStorageSync('token')) {
				console.log(uni.getStorageSync('token'));
				this.goLogins()
			} else {
				this.userinfo = uni.getStorageSync('userinfo')
			}
		},
		methods: {

		}
	}
</script>

<style lang="scss">
	page {
		background-color: #F0F2F5;
	}

	.cantainer {
		background-size: 750rpx 504rpx;
	}

	.top-image {
		width: 750rpx;
		height: 250rpx;
		position: relative;
		object-fit: cover;
	}

	.userinfo {
		position: absolute;
		left: 40rpx;
		top: 60rpx;
		display: flex;
		align-items: center;

		image {
			width: 128rpx;
			height: 128rpx;
			border-radius: 50%;
			border: 2px solid #FFF;
			margin-right: 44rpx;
		}

		.user {
			color: #FFF;
			height: 100rpx;
			line-height: 60rpx;
		}
	}

	.tab {
		width: 630rpx;
		margin: 0 auto;
		display: flex;
		align-items: center;
		justify-content: space-between;
		height: 110rpx;
		background: #FFFFFF;
		box-shadow: 0px 0px 12rpx 0px rgba(189, 189, 189, 0.5);
		border-radius: 16rpx;
		padding: 0 20rpx;
		margin-top: 38rpx;

		image {
			width: 14rpx;
			height: 28rpx;
		}

		view {
			font-size: 28rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #333333;
		}
	}
</style>